<template>
    <example :template-code="templateString">
        <template #describe>
            <t :id="`${$t('时间区间选择')}`">{{ $t('时间区间选择') }}</t>
            <li>
                配置<span class="d-code">isRange</span>即可设置启用区间选择模式
            </li>
        </template>
        <div style="width: 300px;color:#999;">
            <p style="color:#666;">时分秒区间选择：</p>
            <sib-item v-model="value1" :props="props1"></sib-item>
            <p>当前选择的是：{{ value1 }}</p>
        </div>
        <div style="width: 300px;color:#999;">
            <p style="color:#666;">时分区间选择：</p>
            <sib-item v-model="value2" :props="props2"></sib-item>
            <p>当前选择的是：{{ value2 }}</p>
        </div>
    </example>
</template>

<script>
import { ref, reactive } from 'vue';

export default {
    setup() {
        const value1 = ref(null);
        const props1 = reactive({
            type: 'time',
            isRange: true,
            defaultValue: ['05:30:20', '18:56:18'],
        });

        const value2 = ref(['15:30', '16:28']);
        const props2 = reactive({
            type: 'time',
            isRange: true,
            format: 'HH:mm',
            valueFormat: 'HH:mm',
        });

        return {
            value1,
            props1,
            value2,
            props2,
            templateString: `<template>
    <div>
        <p>时分秒区间选择：</p>
        <sib-item v-model="value1" :props="props1"></sib-item>
        <p>当前选择的是：{{ value1 }}</p>
    </div>
    <div>
        <p>时分区间选择：</p>
        <sib-item v-model="value2" :props="props2"></sib-item>
        <p>当前选择的是：{{ value2 }}</p>
    </div>
</template>

<script>
import { ref, reactive } from 'vue';

export default {
    setup() {
        const value1 = ref(null);
        const props1 = reactive({
            type: 'time',
            isRange: true,
            defaultValue: ['05:30:20', '18:56:18'],
        });

        const value2 = ref(['15:30', '16:28']);
        const props2 = reactive({
            type: 'time',
            isRange: true,
            format: 'HH:mm',
            valueFormat: 'HH:mm',
        });

        return { value1, props1, value2, props2 };
    },
};
<\/script>`,
        };
    },
};
</script>
